package com.sgb.goods.viewmodel;

import androidx.lifecycle.MutableLiveData;
import com.sgb.goods.entity.GoodsManageListEntity;
import com.sgb.goods.utils.base.viewmodel.BaseViewModel;
import java.util.List;

/**
 * @作者:陈方凯
 * @日期:2021/12/08
 * @说明:商品管理列表model
 */
public class GoodsManageListModel extends BaseViewModel {
    public MutableLiveData<String> condition = new MutableLiveData<>();
    public MutableLiveData<String> status = new MutableLiveData<>();
    public MutableLiveData<String> cid3 = new MutableLiveData<>();
    public MutableLiveData<List<GoodsManageListEntity>> list = new MutableLiveData<>();
    private int size = 10;
    private int page = 1;
    public int total;


 /*   //获取商品列表
    public void getGoodsListModel(boolean isLoadMore) {
        page = isLoadMore ? page + 1 : 1;
        List<String> cid3List = null;
        if (!cid3.getValue().equals("")) {
            cid3List = new ArrayList<>();
            cid3List.add(cid3.getValue());
        }
        String companyId = SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.REAL_ID,"");
        Map map = new HashMap();
        map.put("pageNum", page);
        map.put("pageSize", size);
        map.put("text", condition.getValue());
        map.put("status", status.getValue());
        if (cid3List != null && cid3List.size() > 0) {
            map.put("cid3", cid3List);
        }
        map.put("companyId", companyId);
        showLoading();
        GoodsNet.getInstance().getGoodsApi().myGoodsList(map).enqueue(new ICallBack<BaseEntity<ListResponse<List<GoodsManageListEntity>>>>() {
            @Override
            public void onSuccess(BaseEntity<ListResponse<List<GoodsManageListEntity>>> data) {
                activity.showList(data.getData().getList(), isLoadMore);
            }
        });
    }

    //获取商品列表全部条件
    public void getGoodsAllModel() {
        NewAPIManager.getInstance().getGoodsReleasedAPI().goodsStatusCategory().enqueue(new ICallBack<BaseEntity<List<DictEntity3>>>() {
            @Override
            public void onSuccess(BaseEntity<List<DictEntity3>> data) {
                activity.showAllPopWindow(data.getData());
            }
        });
    }

    //获取分类类别
    public void getGoodsCategoryModel() {
        NewAPIManager.getInstance().getGoodsReleasedAPI().materialGoodsCategory(repertory.getAreaCode()).enqueue(new ICallBack<BaseEntity<List<MenuEntity<MenuEntity<MenuEntity>>>>>() {
            @Override
            public void onSuccess(BaseEntity<List<MenuEntity<MenuEntity<MenuEntity>>>> data) {
                if (data.getData() != null && data.getData().size() > 0) {
                    activity.showCategoryView(data.getData());
                }
            }
        });
    }

    //上下架删除商品
    public void upDowngetGoodsModel(String opt, List<String> goodsIds) {
        Map map = new HashMap();
        map.put("status", opt);
        map.put("goodsIds", goodsIds);
        NewAPIManager.getInstance().getGoodsReleasedAPI().upDown(map).enqueue(new ICallBack<BaseEntity<Object>>() {
            @Override
            public void onSuccess(BaseEntity<Object> data) {
                activity.showOptSuccess(opt, goodsIds.size());
            }
        });
    }*/
}
